/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#include "MkRtp/MkRtpUtil.h"
#include "MkEvent/MkEventPool.h"
#include "MkEvent/MkEvent.h"
#include "MkEvent/MkTimer.h"
#include "MkUtil/MkLog.h"
#include <signal.h>

CMkTimer *g_pTimer = nullptr;
CMkEventPool* g_pPool = nullptr;
void SigHandle(int sig)
{
    if (sig == SIGINT) {
        g_pTimer->LoopBreak();
    }
};

int main(int argc, char** argv)
{
#ifdef _WIN32
    WSADATA WSAData;
    WSAStartup(0x101, &WSAData);
#endif
    MkLogChangeLevel(LOG_DEBUG);
    signal(SIGINT, SigHandle);
    CMkEventPool Pool;
    g_pPool = &Pool;
    Pool.Start();
    CMkTimer Timer;
    g_pTimer = &Timer;

    Timer.Dispatch();
    Pool.Stop();
#ifdef _WIN32
    WSACleanup();
#endif
    return 0;
}